<template>
	<mescroll-uni ref="mescrollRef" :fixed="false" :down="downOption" @down="downCallback" @up="upCallback" :up="upOption">
		<view><slot></slot></view>
	</mescroll-uni>
</template>

<script>
	import MescrollMixin from '@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js';
	export default {
		name:"haoqiu-pulldown-refresh",
		mixins: [MescrollMixin],
		props: {
			stop: Boolean,
            load: Boolean
		},
		watch: {
			stop(n) {
				if(n) {
					this.mescroll.endSuccess();
				}
			},
            load(n){
                if(n){
                    this.mescroll.endErr();
                }
            }
		},
		computed: {
			downOption() {
				return {
					mustToTop: true,
					outOffsetRate: 0.2,
					offset: 100,
					bgColor: '#ffffff'
				}
			},
			upOption() {
				return {
					use: true,
					isBounce: true,
                    outOffsetRate: 0.2,
                    offset: 100,
                    bgColor: '#ffffff'
				}
			}
		},
		methods: {
			downCallback() {
				this.$emit('refresh')
			},
            upCallback(){
                this.$emit('upLoad') 
            }
		}
	}
</script>

<style>

</style>
